{extend name="index_layout"/}
{block name="main"}
<form class="layui-form" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">工单编号 </label>
        <div class="layui-input-block">
            <input type="text" name="number" disabled lay-verify="required" autocomplete="off" value="{$data.gongdan_nums}" placeholder="工单编号" class="layui-input layui-disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">产品编号 </label>
        <div class="layui-input-block">
            <input type="text" name="number" disabled lay-verify="required" autocomplete="off" value="{$data.product_nums}" placeholder="产品编号" class="layui-input layui-disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">产品名称 </label>
        <div class="layui-input-block">
            <input type="text" name="number" disabled lay-verify="required" autocomplete="off" value="{$data.product_title}" placeholder="产品名称" class="layui-input layui-disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="bitian">*</span>工序编号 </label>
        <div class="layui-input-block">
            <input type="text" name="number" disabled lay-verify="required" autocomplete="off" value="{$data.procedure_nums}" placeholder="工序编号" class="layui-input layui-disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="bitian">*</span>工序名称 </label>
        <div class="layui-input-block">
            <input type="text" name="number" disabled lay-verify="required" autocomplete="off" value="{$data.procedure_title}" placeholder="工序名称" class="layui-input layui-disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="bitian">*</span>报工权限 </label>
        <div class="layui-input-block">
            <textarea name="" id="" cols="30" rows="10" class="layui-disabled layui-textarea" disabled>{$data.auth}</textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="bitian">*</span>报工权限比 </label>
        <div class="layui-input-block">
            <input type="text" name="ratio" lay-verify="required" autocomplete="off" value="{$data.ratio}" placeholder="报工权限比" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="bitian">*</span>计划数 </label>
        <div class="layui-input-block">
            <table class="layui-table" id="attribute">
                <thead>
                    <th>属性</th>
                    <th>数量</th>
                    <th></th>
                </thead>
                <tbody>
                    {volist name="data.plan" key="k" id="item"}
                    <tr>
                        <td><input type="text" value="{$item.key}" name="attr[]"></td>
                        <td><input type="text" value="{$item.nums}" name="nums[]"></td>
                        {if $k > 1}
                        <td><button class="layui-btn layui-btn-xs layui-btn-danger remove" type="button">移除</button></td>
                        {/if}
                    </tr>
                    {/volist}
                </tbody>
            </table>
            <button class="layui-btn layui-btn-xs" id="add-line" type="button" onclick="addline()" style="margin-left: 40%;">新增</button>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="bitian">*</span>良品数 </label>
        <div class="layui-input-block">
            <input type="text" disabled lay-verify="required" autocomplete="off" value="{$data.good}" placeholder="良品数" class="layui-input layui-disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="bitian">*</span>不良品数 </label>
        <div class="layui-input-block">
            <input type="text" disabled lay-verify="required" autocomplete="off" value="{$data.bad}" placeholder="不良品数" class="layui-input layui-disabled">
        </div>
    </div>
    <input type="hidden" name="id" value="{$data.id}">
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="bitian">*</span>计划开始/结束时间 </label>
        <div class="layui-input-block">
            <div class="layui-inline" id="planTime">
                <div class="layui-input-inline">
                  <input type="text" name="plan_begin_time" value="{$data.plan_begin_time}" id="plan_begin_time" class="layui-input" placeholder="开始日期">
                </div>
                <div class="layui-form-mid">-</div>
                <div class="layui-input-inline">
                  <input type="text" name="plan_end_time" value="{$data.plan_end_time}" id="plan_end_time" class="layui-input" placeholder="结束日期">
                </div>
              </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="bitian">*</span>计划开始/结束时间 </label>
        <div class="layui-input-block">
            <div class="layui-inline" id="actualTime">
                <div class="layui-input-inline">
                  <input type="text" name="actual_begin_time" disabled value="{$data.actual_begin_time}" id="actual_begin_time" class="layui-input layui-disabled" placeholder="开始日期">
                </div>
                <div class="layui-form-mid">-</div>
                <div class="layui-input-inline">
                  <input type="text" name="actual_end_time" disabled value="{$data.actual_end_time}" id="actual_end_time" class="layui-input layui-disabled" placeholder="结束日期">
                </div>
              </div>
        </div>
    </div>
    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter='ds' type="button" data-refresh="false">立即提交</button>
            <button class="layui-btn layui-btn-normal" type="button" onclick="var index1 = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index1);">返回</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script>
    function addline(){
        var _html = '<tr>'+
                '<td><input type="text" name="attr[]"></td>'+
                '<td><input type="text" name="nums[]"></td>'+
                '<td><button class="layui-btn layui-btn-xs layui-btn-danger remove" type="button">移除</button></td>'+
            '</tr>';
        $('#attribute').find('tbody').append(_html);
    }
    $('body').on('click','.remove',function(){
        $(this).parent().parent().remove();
    })
    layui.use(['yznForm','form','laydate','jquery'], function() {
        var yznForm = layui.yznForm;
        var form = layui.form;
        var $ = layui.jquery;
        var laydate = layui.laydate;
        yznForm.listen();
        laydate.render({ 
            elem: '#planTime', //开始时间和结束时间所在 input 框的父选择器
            format:'yyyy-MM-dd HH:mm:ss',
            type:"datetime",
            //设置开始日期、日期日期的 input 选择器
            range: ['#plan_begin_time', '#plan_end_time'], //数组格式为 layui 2.6.6 开始
        });
        // laydate.render({ 
        //     elem: '#actualTime', //开始时间和结束时间所在 input 框的父选择器
        //     format:'yyyy-MM-dd HH:mm:ss',
        //     type:"datetime",
        //     //设置开始日期、日期日期的 input 选择器
        //     range: ['#actual_begin_time', '#actual_end_time'], //数组格式为 layui 2.6.6 开始
        // });
    })
</script>
{/block}